//
//  XLGPackFileUpIntermediate.m
//  etionCBLogic
//
//  Created by wjxfhxy on 15-4-29.
//  Copyright (c) 2015年 GuangZhouXuanWu. All rights reserved.
//

#import "XLGPackFileUpIntermediate.h"

@implementation XLGPackUpFileObj
{
    NSString* _fileID;
    NSString* _fileName;
    NSUInteger _length;
    NSString* _MD5;
    NSString* _contentType;
    NSString* _URL;
    NSUInteger _chunkTotal;
    NSUInteger _chunkSize;
    NSString* _uploadChunks;
    NSArray* _backup;
}

@synthesize fileID = _fileID;
@synthesize fileName = _fileName;
@synthesize length = _length;
@synthesize MD5 = _MD5;
@synthesize contentType = _contentType;
@synthesize URL = _URL;
@synthesize chunkTotal = _chunkTotal;
@synthesize chunkSize = _chunkSize;
@synthesize uploadChunks = _uploadChunks;
@synthesize backup = _backup;

-(void)dealloc
{
    [_fileID release_mm];
    [_fileName release_mm];
    [_MD5 release_mm];
    [_contentType release_mm];
    [_URL release_mm];
    [_uploadChunks release_mm];
    [_backup release_mm];
    
    superdealloc_mm;
}

@end

@implementation XLGPackUpChunkObj
{
    GUID _chunkID;
    NSString* _fileID;
    NSString* _fileName;
    NSUInteger _chunkNum;
    NSString* _chunkRange;
    NSData* _data;
}

@synthesize chunkID = _chunkID;
@synthesize fileID = _fileID;
@synthesize fileName = _fileName;
@synthesize chunkNum = _chunkNum;
@synthesize chunkRange = _chunkRange;
@synthesize data = _data;
@synthesize param = _param;

-(void)dealloc
{
    [_fileID release_mm];
    [_fileName release_mm];
    [_chunkRange release_mm];
    [_data release_mm];
    [_param release_mm];
    superdealloc_mm;
}

@end

@implementation XLGPackFileInfo
{
    NSString* _fileName;
    NSString* _fullPath;
    NSData* _packFileData;
}

@synthesize fileName = _fileName;
@synthesize fullPath = _fullPath;

-(NSData*)packFileData
{
    if(_packFileData == nil)
        _packFileData = [[NSData dataWithContentsOfFile:_fullPath] retain_mm];
    return _packFileData;
}

-(void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_fileName forKey:@"filename"];
    [aCoder encodeObject:_fullPath forKey:@"fullpath"];
}

-(id)initWithCoder:(NSCoder *)aDecoder
{
    self.fileName = [aDecoder decodeObjectForKey:@"filename"];
    self.fullPath = [aDecoder decodeObjectForKey:@"fullpath"];
    
    return self;
}

-(void)dealloc
{
    [_fullPath release_mm];
    [_fileName release_mm];
    [_packFileData release_mm];
    superdealloc_mm;
}

@end


@implementation XLGPackFileUpChannelProtocol

- (CProtocolBase*)queryFileProtocol:(XLGPackUpFileObj *)packUpFileObj
{
    return nil;
}

- (CProtocolBase*)uploadFileChunksProtocol:(XLGPackUpChunkObj*)packUpFileObj
{
    return nil;
}

@end
